import request from '@/utils/request'

// 查询商品分类列表
export function listClassification(query) {
  return request({
    url: '/shop/classification/list',
    method: 'get',
    params: query
  })
}

// 查询商品分类列表
export function listNameClassification(query) {
  return request({
    url: '/shop/classification/listName',
    method: 'get',
    params: query
  })
}


// 查询商品分类详细
export function getClassification(id) {
  return request({
    url: '/shop/classification/' + id,
    method: 'get'
  })
}
// 商品分类状态修改
export function changeClassificationStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/shop/classification/changeStatus',
    method: 'put',
    data: data
  })
}
// 新增商品分类
export function addClassification(data) {
  return request({
    url: '/shop/classification',
    method: 'post',
    data: data
  })
}

// 修改商品分类
export function updateClassification(data) {
  return request({
    url: '/shop/classification',
    method: 'put',
    data: data
  })
}

// 删除商品分类
export function delClassification(id) {
  return request({
    url: '/shop/classification/' + id,
    method: 'delete'
  })
}


// 根据用户id关联超市id查询分类列表
export function getClassificationName(userId) {
  return request({
    url: '/shop/classification/classificationName/' + userId,
    method: 'get'
  })
}